package com.xoa.controller.equipment;


import com.xoa.model.equipment.LimsEquipExperience;
import com.xoa.service.equipment.EquipExperienceService;
import com.xoa.util.LimsJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * 创建作者:   陈东虎
 * 创建日期:   13:39 2019/11/6
 * 类介绍:     这个类是一个对设备经验库操作，
 * 参数说明:   * @param null
 * @return
 */
@Controller
@RequestMapping("/experience")
public class LimsEquipExperienceController {
    @Autowired
    private EquipExperienceService equipExperienceService;

//经验库的页面
    @RequestMapping("/index")
    public String index(){
        return "/app/equipment/experience/index";
    }
//添加经验的页面
    @RequestMapping("/goToAddExperience")
    public String addExperience(){
        return "/app/equipment/experience/addExperience";
    }

// 选择设备的映射
    @RequestMapping("/selectType")
    public String selectType(){
        return "/app/equipment/experience/selectType";
    }


    /**
     * 创建作者:   陈东虎
     * 创建日期:   14:39 2019/11/6
     * 方法介绍:   分页查询所有经验库
     * 参数说明:   * @param
     * @return    LimsJson<LimsEquipExperience>
     */
    @RequestMapping("/selectAllEquipmentExperience")
    @ResponseBody
    public LimsJson<LimsEquipExperience> selectAllEquipmentExperience(HttpServletRequest request, Integer page, Integer limit) {
        return equipExperienceService.selectAllEquipmentExperience(request, page, limit);
    }

    /**
     * 创建作者:   陈东虎
     * 创建日期:   14:39 2019/11/6
     * 方法介绍:   单独查询经验库某个设备经验详情
     * 参数说明:   ExperId
     * @return    LimsJson<LimsEquipExperience>
     */
    @RequestMapping("/selectEquipmentByExperId")
    @ResponseBody
    public LimsJson<LimsEquipExperience> selectEquipmentByExperId(HttpServletRequest request,int experId,String dataType) {
        return equipExperienceService.selectEquipmentByExperId(request,experId,dataType);
    }

    /**
     * 创建作者:   陈东虎
     * 创建日期:   14:39 2019/11/6
     * 方法介绍:   根据下拉选择字段模糊查询经验库
     * 参数说明:   FieldName 字段名 FieldValue模糊查询的值
     * @return    LimsJson<LimsEquipExperience>
     */
    @RequestMapping("/selectExperienceByName")
    @ResponseBody
    public LimsJson<LimsEquipExperience> selectExperienceByName(HttpServletRequest request,String fieldName,String fieldValue,Integer page,Integer limit) {
        return equipExperienceService.selectExperienceByName(request,fieldName,fieldValue,page,limit);
    }

    /**
     * 创建作者:   陈东虎
     * 创建日期:   14:39 2019/11/6
     * 方法介绍:   根据ExperId删除经验库
     * 参数说明:   ExperId
     * @return    LimsJson
     */
    @RequestMapping("/delExperienceByExperId")
    @ResponseBody
    public LimsJson<LimsEquipExperience> delExperienceByExperId(HttpServletRequest request,String experIds){
        return equipExperienceService.delExperienceByExperId(request,experIds);
    }

    /**
     * 创建作者:   陈东虎
     * 创建日期:   14:39 2019/11/6
     * 方法介绍:   添加经验库
     * 参数说明:   LimsEquipExperience
     * @return    LimsJson
     */
    @RequestMapping("/addExperience")
    @ResponseBody
    public LimsJson<LimsEquipExperience> addExperience(HttpServletRequest request,LimsEquipExperience experience){
        return equipExperienceService.addExperience(request,experience);
    }

    /**
     * 创建作者:   陈东虎
     * 创建日期:   14:39 2019/11/6
     * 方法介绍:   根据搜索条件筛选查询
     * 参数说明:   EquipExperience
     * @return    LimsJson<LimsEquipExperience>
     */
        @RequestMapping("/getEquipBySearch")
        @ResponseBody
        LimsJson<LimsEquipExperience> selectExperienceByCondition(HttpServletRequest request,LimsEquipExperience experience,Integer page,Integer limit){
            return equipExperienceService.selectExperienceByCondition(request,experience,page,limit);
        }


    /**
     * 创建作者:   陈东虎
     * 创建日期:   14:39 2019/11/12
     * 方法介绍:   修改经验库
     * 参数说明:   EquipExperience experId
     * @return    LimsJson<LimsEquipExperience>
     */
    @RequestMapping("/editExperience")
    @ResponseBody
    LimsJson editExperience(HttpServletRequest request, LimsEquipExperience limsEquipExperience){
        return equipExperienceService.editExperience(request,limsEquipExperience);
    }

    /**
     * 创建作者:   陈东虎
     * 创建日期:   14:39 2019/11/12
     * 方法介绍:   修改经验库
     * 参数说明:   EquipExperience experId
     * @return    LimsJson<LimsEquipExperience>
     */
    @RequestMapping("/selectExperienceByEquipType")
    @ResponseBody
    LimsJson getExperienceByEquipType(HttpServletRequest request,Integer equipType,Integer limit,Integer page){
        return equipExperienceService.getExperienceByEquipType(request,equipType,limit,page);
    }

}